package com.ruoyi.courseManagement.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.courseManagement.domain.Category;
import com.ruoyi.courseManagement.domain.vo.CategoryVO;
import com.ruoyi.courseManagement.mapper.CategoryMapper;
import com.ruoyi.courseManagement.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课程分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-09
 */
@Service
public class CategoryServiceImpl implements CategoryService
{
    @Autowired
    private CategoryMapper categoryMapper;

    /**
     * 查询课程分类
     * 
     * @param categoryId 课程分类主键
     * @return 课程分类
     */
    @Override
    public Category selectCategoryByCategoryId(Integer categoryId)
    {
        return categoryMapper.selectCategoryByCategoryId(categoryId);
    }

    /**
     * 查询课程分类列表
     * 
     * @param categoryVO 课程分类
     * @return 课程分类
     */
    @Override
    public List<CategoryVO> selectCategoryList(CategoryVO categoryVO)
    {
        return categoryMapper.selectCategoryList(categoryVO);
    }

    @Override
    public List<Category> selectCategoryListByCampusId(Integer campusId) {
        return categoryMapper.selectCategoryListByCampusId(campusId);
    }

//    @Override
//    public List<CampusVO> selectCampusList() {
//        return categoryMapper.selectCampusList();
//    }

    /**
     * 新增课程分类
     * 
     * @param category 课程分类
     * @return 结果
     */
    @Override
    public int insertCategory(Category category)
    {
        category.setCreateTime(DateUtils.getNowDate());
        return categoryMapper.insertCategory(category);
    }

    /**
     * 修改课程分类
     * 
     * @param category 课程分类
     * @return 结果
     */
    @Override
    public int updateCategory(Category category)
    {
        category.setUpdateTime(DateUtils.getNowDate());
        return categoryMapper.updateCategory(category);
    }

    /**
     * 批量删除课程分类
     * 
     * @param categoryIds 需要删除的课程分类主键
     * @return 结果
     */
    @Override
    public int deleteCategoryByCategoryIds(Integer[] categoryIds)
    {
        return categoryMapper.deleteCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除课程分类信息
     * 
     * @param categoryId 课程分类主键
     * @return 结果
     */
    @Override
    public int deleteCategoryByCategoryId(Integer categoryId)
    {
        return categoryMapper.deleteCategoryByCategoryId(categoryId);
    }
}
